package week08;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        List<Integer> A = new ArrayList<Integer>();
        List<Integer> B = new ArrayList<Integer>();
        A.clear();
        B.clear();
        for (int i = 0; i < n; i++) {
            int t = in.nextInt();
            if(t%2==1) {
                A.add(t);
            }
            else B.add(t);
        }
        int count = 0;
        List<Integer> ans = new ArrayList<Integer>();
        while(++count!=0) {
            if(B.isEmpty()&&A.isEmpty())
                break;
            if(count%3==0) {
                if(!B.isEmpty())
                    ans.add(B.remove(0));
                else ans.add(A.remove(0));
                continue;
            }
            if(!A.isEmpty()) {
                ans.add(A.remove(0));
            }
            else ans.add(B.remove(0));
        }
        Object[] a = ans.toArray();
        for (int i = 0; i < a.length; i++) {
            if(i==a.length-1) {
                System.out.print(a[i]);
                continue;
            }
            System.out.print(a[i]+" ");

        }
    }
}